package cn.silver.module.oss.bean;

import cn.silver.framework.core.validate.AddGroup;
import cn.silver.framework.core.validate.EditGroup;
import cn.silver.framework.mybatis.bean.BusBean;
import cn.silver.module.oss.domain.OssConfig;
import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author zhouxiaobo
 */
@Data
@NoArgsConstructor
@AutoMapper(target = OssConfig.class)
@EqualsAndHashCode(callSuper = true)
@Schema(name = "ConfigBean", title = "对象存储管理-存储配置信息")
public class ConfigBean extends BusBean implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    /**
     * 账号
     */
    @Schema(title = "账号")
    @NotBlank(message = "访问账号不能为空", groups = {AddGroup.class, EditGroup.class})
    private String access;
    /**
     * 秘钥
     */
    @Schema(title = "秘钥")
    @NotBlank(message = "访问秘钥不能为空", groups = {AddGroup.class, EditGroup.class})
    private String secret;
    /**
     * 访问协议
     */
    @Schema(title = "访问协议")
    @NotBlank(message = "访问协议不能为空", groups = {AddGroup.class, EditGroup.class})
    private String proxy;
    /**
     * 访问站点
     */
    @Schema(title = "访问站点")
    @NotBlank(message = "访问站点不能为空", groups = {AddGroup.class, EditGroup.class})
    private String endpoint;
    /**
     * 前缀
     */
    @Schema(title = "前缀")
    private String prefix;
    /**
     * 桶名称
     */
    @Schema(title = "桶名称")
    @NotBlank(message = "存储桶名称不能为空", groups = {AddGroup.class, EditGroup.class})
    private String bucket;
    /**
     * 自定义域名
     */
    @Schema(title = "自定义域名")
    private String domain;
    /**
     * 域
     */
    @Schema(title = "域")
    private String region;
    /**
     * 桶权限类型
     */
    @Schema(title = "桶权限类型")
    @NotBlank(message = "存储桶权限不能为空", groups = {AddGroup.class, EditGroup.class})
    private String policy;
    /**
     * 是否默认
     */
    @Schema(title = "是否默认")
    private Boolean defaulted;
}
